package com.itheima;

import com.itheima.utils.IdWorker;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMethod;
import tk.mybatis.spring.annotation.MapperScan;


@EnableEurekaClient
@CrossOrigin(allowCredentials="true", allowedHeaders="*", methods={RequestMethod.GET,RequestMethod.POST}, origins="*")
@SpringBootApplication(scanBasePackages = "com.itheima")
@EntityScan("com.itheima.pojo")
@MapperScan(basePackages = {"com.itheima.dao"})
public class AdminApplication {

    public static void main(String[] args) {
        System.setProperty("es.set.netty.runtime.available.processors","false");
        System.setProperty("es.set.netty.runtime.available.processors","false");
        SpringApplication.run(AdminApplication.class);
    }

    @Bean
    public IdWorker idWorker(){
        return new IdWorker();
    }
}
